import 'package:flutter/material.dart';

class ButtonsPage extends StatefulWidget {
  final Map<String, dynamic> arguments;
  ButtonsPage({Key key, this.arguments}) : super(key: key);

  @override
  _ButtonsPageState createState() => _ButtonsPageState();
}

class _ButtonsPageState extends State<ButtonsPage> {
  @override
  Widget build(BuildContext context) {
    final double rowHeight = 60.0;

    return Container(
      child: Scaffold(
        appBar: AppBar(
          title: Text('ButtonsPage'),
        ),
        floatingActionButton: FloatingActionButton(
          backgroundColor: Colors.red,
          elevation: 0.0,
          shape: RoundedRectangleBorder(
            borderRadius: BorderRadius.circular(20.0),
          ),
          onPressed: () {
            print('');
          },
          child: Text('浮动'),
        ),
        floatingActionButtonLocation: FloatingActionButtonLocation.centerFloat,
        body: ListView(
          children: <Widget>[
            Container(
              height: rowHeight,
              alignment: Alignment.centerLeft,
              child: RaisedButton(
                child: Text('RaisedButton'),
                color: Colors.yellow,
                textColor: Colors.red,
                elevation: 0.0,
                // onPressed: null, // 设置为 null 按钮将被置为禁用状态
                onPressed: () {
                  print('');
                },
              ),
            ),
            Divider(height: 1.0),
            Container(
              height: rowHeight,
              alignment: Alignment.centerLeft,
              child: Container(
                height: 30.0,
                width: 200.0,
                child: RaisedButton(
                  child: Text('自定义宽高按钮'),
                  onPressed: () {
                    print('');
                  },
                ),
              ),
            ),
            Divider(height: 1.0),
            Container(
              height: rowHeight,
              alignment: Alignment.centerLeft,
              child: Row(
                children: <Widget>[
                  Expanded(
                    child: Container(
                      margin: EdgeInsets.fromLTRB(15.0, 0.0, 15.0, 0.0),
                      child: RaisedButton(
                        child: Text('自适应宽度(与屏幕同宽)'),
                        onPressed: () {
                          print('');
                        },
                      ),
                    ),
                  ),
                ],
              ),
            ),
            Divider(height: 1.0),
            Container(
              height: rowHeight,
              alignment: Alignment.centerLeft,
              child: RaisedButton.icon(
                onPressed: () {},
                icon: Icon(Icons.settings),
                label: Text('带图标按钮'),
              ),
            ),
            Divider(height: 1.0),
            Container(
              height: rowHeight,
              alignment: Alignment.centerLeft,
              child: RaisedButton(
                child: Text('圆角按钮'),
                splashColor: Colors.red,
                shape: RoundedRectangleBorder(
                  borderRadius: BorderRadius.circular(10.0),
                ),
                onPressed: () {
                  print('');
                },
              ),
            ),
            Divider(height: 1.0),
            Container(
              height: rowHeight,
              alignment: Alignment.centerLeft,
              child: FlatButton(
                color: Colors.green,
                onPressed: () {
                  print('');
                },
                child: Text('扁平化按钮'),
              ),
            ),
            Divider(height: 1.0),
            Container(
              margin: EdgeInsets.fromLTRB(10.0, 0.0, 0.0, 0.0),
              height: rowHeight,
              alignment: Alignment.centerLeft,
              child: OutlineButton(
                child: Text('边框按钮'),
                textColor: Colors.cyan,
                onPressed: () {
                  print('');
                },
              ),
            ),
            Divider(height: 1.0),
            Container(
              margin: EdgeInsets.fromLTRB(10.0, 0.0, 0.0, 0.0),
              height: rowHeight,
              alignment: Alignment.centerLeft,
              child: IconButton(
                icon: Icon(Icons.search),
                onPressed: () {
                  print('');
                },
              ),
            ),
            Divider(height: 1.0),
            Container(
              height: rowHeight,
              child: Row(
                mainAxisAlignment: MainAxisAlignment.center,
                children: <Widget>[
                  ButtonBar(
                    children: <Widget>[
                      RaisedButton(
                        child: Text('按钮组 btn0'),
                        onPressed: () {
                          print('');
                        },
                      ),
                      RaisedButton(
                        child: Text('按钮组 btn1'),
                        onPressed: () {
                          print('');
                        },
                      )
                    ],
                  ),
                ],
              ),
            ),
            Divider(height: 1.0),
          ],
        ),
      ),
    );
  }
}
